26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
49 #pragma package(smart_init)
62 Graphics::TBitmap* SmallGraphicPtrVal): SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
64 for(
int x = 0; x < 4; x++)
73 else if(SpeedTagVal == 77)
75 else if(SpeedTagVal == 78)
77 else if(SpeedTagVal == 79)
79 else if(SpeedTagVal == 96)
81 else if(SpeedTagVal == 129)
83 else if(SpeedTagVal == 130)
85 else if(SpeedTagVal == 131)
87 else if(SpeedTagVal == 145)
89 else if(SpeedTagVal == 146)
96 FixedNamedLocationElement(false)
98 for(
int x = 0; x < 4; x++)
109 AnsiString(VLocInput));
122 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
132 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
144 Graphics::TBitmap *GraphicOutput = GraphicPtr;
146 if(LocationName ==
"")
191 GraphicOutput = GraphicPtr;
195 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
204 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
205 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
214 if(lower.second < higher.second)
218 else if(lower.second > higher.second)
222 else if(lower.second == higher.second)
224 if(lower.first < higher.first)
237 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
238 CheckCount(9), IsARoute(false), AutoSignals(false), ConsecSignals(false)
242 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
253 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
281 {2, 4}, {6, 2}, {8, 6}, {4, 8},
282 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
290 else if(
Link[2] == -1)
299 else if(
Link[2] == -1)
307 for(
int x = 0; x < 16; x++)
309 if((Entry == EXArray[x][0]) && (Exit == EXArray[x][1]) || (Entry == EXArray[x][1]) && (Exit == EXArray[x][0]))
439 throw Exception(
"Error in EntryExitNumber 4");
515 throw Exception(
"Error in EntryExitNumber 5");
536 if(!AutoSigsFlag && !ConsecSignalsRoute)
589 throw Exception(
"Error in EntryExitNumber 6");
603 else if(!AutoSigsFlag && ConsecSignalsRoute)
656 throw Exception(
"Error in EntryExitNumber 10");
723 throw Exception(
"Error in EntryExitNumber 11");
796 throw Exception(
"Error in EntryExitNumber 7");
821 throw Exception(
"Error in EntryExitNumber 8");
832 if((ELink > 0) && (ELink < 10) && (ELink != 5))
834 if(!AutoSigsFlag && !ConsecSignalsRoute)
836 else if(!AutoSigsFlag && ConsecSignalsRoute)
843 throw Exception(
"Error in EntryExitNumber 9");
879 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
904 AnsiString NL =
'\n';
907 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL +
908 "blocked by a train, another route or a changing level crossing; " + NL +
909 "or invalid - possibly due to a preferred direction mismatch or a missed signal in a green or blue route.";
916 int InternalLinkCheckArray[9][2] =
917 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
922 for(
int x = 0; x < 9; x++)
923 for(
int y = 0; y < 2; y++)
927 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
929 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
930 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
931 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
932 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
933 << 60 << 61 << 62 << 63 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
940 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
942 for(
int x = 0; x < 10; x++)
943 for(
int y = 0; y < 2; y++)
949 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
952 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
953 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
955 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
956 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
958 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
959 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
962 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
965 for(
int x = 0; x < 40; x++)
971 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
974 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
975 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
977 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
978 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
980 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
981 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
984 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
987 for(
int x = 0; x < 40; x++)
993 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
996 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
997 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
999 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1000 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1002 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1003 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1006 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1009 for(
int x = 0; x < 40; x++)
1035 for(
int x = 0; x < 40; x++)
1062 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1063 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1064 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1065 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1066 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1067 {0, 0, 129}, {0, -1, 145},
1070 for(
int x = 0; x < 25; x++)
1071 for(
int y = 0; y < 3; y++)
1076 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1077 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1078 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1079 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1080 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1081 {0, 0, 129}, {0, 1, 145},
1084 for(
int x = 0; x < 25; x++)
1085 for(
int y = 0; y < 3; y++)
1090 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1091 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1092 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1093 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1094 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1095 {0, 0, 130}, {-1, 0, 146},
1098 for(
int x = 0; x < 25; x++)
1099 for(
int y = 0; y < 3; y++)
1104 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1105 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1106 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1107 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1108 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1109 {0, 0, 130}, {1, 0, 146},
1112 for(
int x = 0; x < 25; x++)
1113 for(
int y = 0; y < 3; y++)
1118 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1119 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1120 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1121 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1122 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1123 {0, -1, 129}, {1, 0, 130},
1124 {-1, 0, 130}, {0, 1, 145},
1125 {0, -1, 145}, {1, 0, 146},
1128 for(
int x = 0; x < 28; x++)
1129 for(
int y = 0; y < 3; y++)
1144 for(
int x = 0; x < 8; x++)
1145 for(
int y = 0; y < 3; y++)
1160 for(
int x = 0; x < 8; x++)
1161 for(
int y = 0; y < 3; y++)
1176 for(
int x = 0; x < 8; x++)
1177 for(
int y = 0; y < 3; y++)
1192 for(
int x = 0; x < 8; x++)
1193 for(
int y = 0; y < 3; y++)
1198 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1200 for(
int x = 0; x < 4; x++)
1201 for(
int y = 0; y < 3; y++)
1205 {0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1206 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1207 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1208 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1209 140, 144, 145, 146};
1212 {0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1213 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1214 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1215 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1216 141, 144, 145, 146};
1219 {0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1220 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1221 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1222 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1223 141, 144, 146, 145};
1226 {0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1227 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1228 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1229 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1230 140, 144, 146, 145};
1250 delete UGMIt->second;
1324 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1325 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1327 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1334 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1335 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1348 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1349 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1351 {4, 6, 2, 8}, {1, 9, 3, 7},
1353 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1355 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8
1356 }, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1359 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1360 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6
1362 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1364 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1
1366 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1367 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1369 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1372 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1373 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1374 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1375 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1376 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1377 {4, 6, -1, -1}, {2, 8, -1, -1},
1379 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1381 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1383 {4, 6, -1, -1}, {2, 8, -1, -1},
1388 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1389 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1390 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1391 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1394 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1395 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1396 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1398 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1399 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1400 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1402 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1404 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1405 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1406 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1407 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1408 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1409 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1410 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1411 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet
1413 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1414 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1415 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet
1417 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1418 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1420 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1421 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1422 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1423 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1424 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1425 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1426 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1427 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1431 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1432 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1433 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1439 for(
int x = 0; x < 17; x++)
1441 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1443 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1447 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1453 ExistingGraphicLoaded(false), Width(16), Height(16)
1465 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1503 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1507 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1511 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1515 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1538 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1541 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1545 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1549 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1583 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1604 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1618 bool TrackPresent =
false;
1632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1635 TrackPresent =
true;
1639 return !TrackPresent;
1647 bool TrackPresent =
false;
1656 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1659 TrackPresent =
true;
1664 return !TrackPresent;
1669 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1672 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1673 TrackEraseSuccessfulFlag =
false;
1678 ErasedTrackVectorPosition = -1;
1679 AnsiString SName =
"", ErrorString;
1681 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1687 TrackMapKeyPair.first = HLocInput;
1688 TrackMapKeyPair.second = VLocInput;
1689 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1700 if(ErrorString !=
"")
1702 throw Exception(ErrorString +
" for EraseTrackElement 1");
1725 ErasedTrackVectorPosition = VecPos;
1726 TrackEraseSuccessfulFlag =
true;
1733 unsigned int VecPos;
1734 InactiveTrackMapKeyPair.first = HLocInput;
1735 InactiveTrackMapKeyPair.second = VLocInput;
1740 VecPos = InactiveTrack2MultiMapIterator->second;
1745 if(ErrorString !=
"")
1747 throw Exception(ErrorString +
" for EraseTrackElement 2A");
1757 TrackEraseSuccessfulFlag =
true;
1777 VecPos = InactiveTrack2MultiMapIterator->second;
1782 if(ErrorString !=
"")
1784 throw Exception(ErrorString +
" for EraseTrackElement 2B");
1806 if(TrackEraseSuccessfulFlag)
1828 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1829 bool PlatAllowedFlag =
false;
1831 TrackLinkingRequiredFlag =
false;
1843 LocationNameEntry.first =
"";
1852 TempTrackElement.
HLoc = HLocInput;
1853 TempTrackElement.
VLoc = VLocInput;
1879 else if(Aspect == 1)
1881 else if(Aspect == 2)
1883 else if(Aspect == 3)
1889 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
1892 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
1894 if(InactiveFoundFlag)
1897 NonStationOrLevelCrossingPresent =
true;
1899 NonStationOrLevelCrossingPresent =
true;
1901 PlatformPresent =
true;
1912 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
1919 PlatAllowedFlag =
true;
1923 PlatAllowedFlag =
true;
1927 PlatAllowedFlag =
true;
1931 PlatAllowedFlag =
true;
1935 TrackLinkingRequiredFlag =
true;
1962 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
1963 (!FoundFlag && !InactiveFoundFlag))
1966 TrackLinkingRequiredFlag =
true;
1999 TrackLinkingRequiredFlag =
true;
2011 else if(FoundFlag || InactiveFoundFlag)
2031 bool BothPointFillets =
true;
2045 TrackLinkingRequiredFlag =
true;
2058 bool InternalChecks)
2066 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2067 bool PlatAllowedFlag =
false;
2069 TrackLinkingRequiredFlag =
false;
2081 LocationNameEntry.first =
"";
2088 TempTrackElement.
HLoc = HLocInput;
2089 TempTrackElement.
VLoc = VLocInput;
2090 for(
int x = 0; x < 4; x++)
2094 TempTrackElement.
Conn[x] = -1;
2098 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2109 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2111 if(InactiveFoundFlag)
2114 NonStationOrLevelCrossingPresent =
true;
2116 NonStationOrLevelCrossingPresent =
true;
2118 PlatformPresent =
true;
2129 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2136 PlatAllowedFlag =
true;
2140 PlatAllowedFlag =
true;
2144 PlatAllowedFlag =
true;
2148 PlatAllowedFlag =
true;
2152 TrackLinkingRequiredFlag =
true;
2182 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2183 (!FoundFlag && !InactiveFoundFlag))
2186 TrackLinkingRequiredFlag =
true;
2222 TrackLinkingRequiredFlag =
true;
2234 else if(FoundFlag || InactiveFoundFlag)
2254 bool BothPointFillets =
true;
2268 TrackLinkingRequiredFlag =
true;
2296 ShowMessage(
"Gaps must be set before track can be validated");
2305 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2316 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2334 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2341 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2366 std::pair<AnsiString, char>TempMapPair;
2374 TempMapPair.second =
'x';
2387 int NewHLoc, NewVLoc;
2388 bool ConnectionFoundFlag, LinkFoundFlag;
2390 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2392 for(
unsigned int y = 0; y < 4; y++)
2404 ConnectionFoundFlag =
false;
2405 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2411 ConnectionFoundFlag =
true;
2413 LinkFoundFlag =
false;
2414 for(
unsigned int a = 0; a < 4; a++)
2418 LinkFoundFlag =
true;
2433 if(!ConnectionFoundFlag)
2506 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2521 bool UnsetGaps =
false;
2528 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2532 for(
unsigned int y = 0; y < 4; y++)
2544 for(
unsigned int y = 0; y < 4; y++)
2554 for(
unsigned int y = 1; y < 4; y++)
2563 for(
unsigned int y = 0; y < 4; y++)
2576 for(
unsigned int y = 0; y < 4; y++)
2603 int NumberOfActiveElements = 0;
2605 GraphicsFollow =
false;
2609 if(MarkerString[MarkerString.Length()] ==
'1')
2611 GraphicsFollow =
true;
2613 for(
int x = 0; x < NumberOfActiveElements; x++)
2619 TrackElement.
HLoc = TempInt;
2621 TrackElement.
VLoc = TempInt;
2627 TrackElement.
Conn[0] = TempInt;
2647 if((TempInt != -1) && (TempInt < 10))
2653 if((TempInt != -1) && (TempInt < 10))
2666 if(Marker[1] ==
'3')
2670 else if(Marker[1] ==
'2')
2674 else if(Marker[1] ==
'G')
2686 int NumberOfInactiveElements = 0;
2690 for(
int x = 0; x < NumberOfInactiveElements; x++)
2696 TrackElement.
HLoc = TempInt;
2698 TrackElement.
VLoc = TempInt;
2704 bool LocError =
false;
2733 for(
int x = 0; x < NumberOfGraphics; x++)
2744 bool FileError =
false;
2746 for(
int x = 0; x < NumberOfGraphics; x++)
2759 UGME.second =
new TPicture;
2760 UGME.second->LoadFromFile(
UGME.first);
2763 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
2770 catch(
const EInvalidGraphic &e)
2773 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
2780 delete UGMIt->second;
2785 catch(
const Exception &e)
2787 ShowMessage(
"Unable to load file, ensure that this graphic file exists: " + UGI.
FileName +
2788 ", and that it is has extension .bmp, .gif, .jpg, or .png. Graphics can't be loaded.");
2795 delete UGMIt->second;
2803 bool FoundInMap =
false;
2822 UGME.second =
new TPicture;
2823 UGME.second->LoadFromFile(
UGME.first);
2826 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
2833 catch(
const EInvalidGraphic &e)
2836 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
2843 delete UGMIt->second;
2848 catch(
const Exception &e)
2850 ShowMessage(
"Unable to load file, ensure that this graphic file exists: " + UGI.
FileName +
2851 ", and that it is has extension .bmp, .gif, .jpg, or .png");
2858 delete UGMIt->second;
2883 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
2887 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
2889 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
2892 VecFile << x <<
'\n';
2893 VecFile << TrackElement.
SpeedTag <<
'\n';
2894 VecFile << TrackElement.
HLoc <<
'\n';
2895 VecFile << TrackElement.
VLoc <<
'\n';
2899 VecFile << TrackElement.
Conn[0] <<
'\n';
2903 VecFile << TrackElement.
Attribute <<
'\n';
2908 VecFile << int(1) <<
'\n';
2910 VecFile << int(0) <<
'\n';
2912 VecFile << TrackElement.
Length01 <<
'\n';
2913 VecFile << TrackElement.
Length23 <<
'\n';
2916 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
2923 VecFile <<
"3*****" <<
'\0' <<
'\n';
2927 VecFile <<
"2*****" <<
'\0' <<
'\n';
2931 VecFile <<
"G*****" <<
'\0' <<
'\n';
2935 VecFile <<
"4*****" <<
'\0' <<
'\n';
2940 VecFile <<
"******" <<
'\0' <<
'\n';
2945 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
2949 VecFile << x <<
'\n';
2950 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
2951 VecFile << InactiveTrackElement.
HLoc <<
'\n';
2952 VecFile << InactiveTrackElement.
VLoc <<
'\n';
2953 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
2954 VecFile <<
"******" <<
'\0' <<
'\n';
2969 GraphicsFollow =
false;
2971 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
2977 AnsiString MarkerString;
2984 if(MarkerString[MarkerString.Length()] ==
'1')
2986 GraphicsFollow =
true;
2988 for(
int x = 0; x < NumberOfActiveElements; x++)
2996 int SpeedTag = TempInt;
3003 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3009 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3014 if((SpeedTag > 87) && (SpeedTag < 96))
3017 if((TempInt < -1) || (TempInt > 3))
3023 if((TempInt < -1) || (TempInt > 999999))
3029 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3030 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3033 if((TempInt < -1) || (TempInt > 5))
3039 if((SpeedTag >= 68) && (SpeedTag <= 75))
3042 if((TempInt != 0) && (TempInt != 1))
3049 if((TempInt < -1) || (TempInt > 999999))
3055 if((TempInt < -1) || (TempInt > 999999))
3061 if((TempInt < -1) || (TempInt > 999999))
3067 if((TempInt < -1) || (TempInt > 999999))
3088 int NumberOfInactiveElements = 0;
3091 if(NumberOfInactiveElements < 0)
3101 for(
int x = 0; x < NumberOfInactiveElements; x++)
3115 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3121 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3148 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3154 AnsiString FileName;
3156 for(
int x = 0; x < NumberOfGraphics; x++)
3158 TPicture *TempPicture =
new TPicture;
3166 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3179 catch(
const EInvalidGraphic &e)
3181 ShowMessage(FileName +
3182 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3187 catch(
const Exception &e)
3189 ShowMessage(
"Unable to load file, ensure that " + FileName +
3190 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3208 for(
int x = 0; x < VecSize; x++)
3231 for(
int x = 0; x < VecSize; x++)
3253 for(
int x = 0; x < VecSize; x++)
3307 for(
int x = 0; x < VecSize; x++)
3364 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3375 if(BothPointFilletsAndBasicLCs)
3450 Bitmap->Canvas->CopyMode = cmSrcCopy;
3452 Graphics::TBitmap *GraphicOutput;
3623 for(
int x = 0; x < 40; x++)
3642 Graphics::TBitmap *GraphicPtr;
3651 Graphics::TBitmap* SignalPlatformGraphic;
3684 if(OldTransparentColour !=
clB5G5R5)
3707 Bitmap->Canvas->CopyMode = cmSrcCopy;
3735 Bitmap->Canvas->CopyMode = cmSrcCopy;
3737 Graphics::TBitmap *GraphicOutput;
3747 if(BaseElement == 1)
3835 for(
int x = 0; x < 40; x++)
3854 Graphics::TBitmap *GraphicPtr;
3863 Graphics::TBitmap* SignalPlatformGraphic;
3924 for(
int x = 0; x < 40; x++)
3932 Graphics::TBitmap* SignalPlatformGraphic;
3953 if(OldTransparentColour !=
clB5G5R5)
3967 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4037 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4051 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4076 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4101 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4131 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4165 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4201 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4216 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4246 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4253 throw Exception(
"Error - Map & Vector different sizes");
4255 unsigned int NonZeroCount = 0;
4257 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4264 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4271 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4275 TrackMapEntry.first = TrackMapKeyPair;
4276 TrackMapEntry.second = x;
4277 if(!(
TrackMap.insert(TrackMapEntry).second))
4279 throw Exception(
"Error - map insertion failure, TrackVector in error");
4283 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4285 for(
unsigned int y = 0; y < 4; y++)
4310 THVPair GapMapKeyPair, GapMapValuePair;
4313 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4319 GapMapEntry.first = GapMapKeyPair;
4322 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4326 GapMapEntry.second = GapMapValuePair;
4329 GapMap.insert(GapMapEntry);
4342 bool CheckForLinks =
false;
4344 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4354 "Footbridge or underpass connection error. Each end must connect to a platform, concourse or other footbridge or underpass, and they can't connect to each other");
4362 for(
unsigned int y = 0; y < 4; y++)
4364 CheckForLinks =
false;
4376 bool ConnectionFoundFlag;
4380 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4386 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4393 if(ConnectionFoundFlag)
4397 bool LinkFoundFlag =
false;
4400 ShowMessage(
"Can't have an exit signal next to a level crossing");
4406 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4412 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation");
4420 ShowMessage(
"Can't have two same-direction signals adjacent to each other");
4427 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4430 CheckForLinks =
true;
4433 for(
unsigned int a = 0; a < 4; a++)
4442 LinkFoundFlag =
true;
4455 throw Exception(
"Error in final track linkage - invalid link");
4469 throw Exception(
"Error in final track linkage - connection not found");
4481 bool ConnErrorFlag =
false;
4483 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4486 ConnErrorFlag =
true;
4488 ConnErrorFlag =
true;
4490 ConnErrorFlag =
true;
4492 ConnErrorFlag =
true;
4495 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4497 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4499 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4508 throw Exception(
"ConnError in LinkTrack - Final");
4512 throw Exception(
"ConnError in LinkTrack - Precheck");
4516 bool CLkErrorFlag =
false;
4518 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4521 CLkErrorFlag =
true;
4523 CLkErrorFlag =
true;
4525 CLkErrorFlag =
true;
4527 CLkErrorFlag =
true;
4534 throw Exception(
"CLkError in LinkTrack - Final");
4538 throw Exception(
"CLkError in LinkTrack - Precheck");
4543 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4566 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4581 for(
unsigned int y = 0; y < 4; y++)
4594 bool ConnectionFoundFlag;
4600 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4607 if(ConnectionFoundFlag)
4610 bool LinkFoundFlag =
false;
4667 for(
unsigned int a = 0; a < 4; a++)
4676 LinkFoundFlag =
true;
4684 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
4694 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
4706 bool ConnErrorFlag =
false;
4708 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4711 ConnErrorFlag =
true;
4713 ConnErrorFlag =
true;
4715 ConnErrorFlag =
true;
4717 ConnErrorFlag =
true;
4720 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4722 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4724 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4733 throw Exception(
"ConnError in LinkTrack - Final");
4737 throw Exception(
"ConnError in LinkTrack - Precheck");
4741 bool CLkErrorFlag =
false;
4743 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4746 CLkErrorFlag =
true;
4748 CLkErrorFlag =
true;
4750 CLkErrorFlag =
true;
4752 CLkErrorFlag =
true;
4759 throw Exception(
"CLkError in LinkTrack - Final");
4763 throw Exception(
"CLkError in LinkTrack - Precheck");
4768 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4791 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4809 for(
unsigned int y = 0; y < 4; y++)
4822 bool ConnectionFoundFlag =
false;
4824 if(ConnectionFoundFlag)
4828 bool LinkFoundFlag =
false;
4848 for(
unsigned int a = 0; a < 4; a++)
4857 LinkFoundFlag =
true;
4877 bool ConnErrorFlag =
false;
4879 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4882 ConnErrorFlag =
true;
4884 ConnErrorFlag =
true;
4886 ConnErrorFlag =
true;
4888 ConnErrorFlag =
true;
4896 bool CLkErrorFlag =
false;
4898 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4901 CLkErrorFlag =
true;
4903 CLkErrorFlag =
true;
4905 CLkErrorFlag =
true;
4907 CLkErrorFlag =
true;
4924 int Position1, Position2;
4930 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
4932 int HLoc1 = GapMapPtr->first.first;
4933 int VLoc1 = GapMapPtr->first.second;
4934 int HLoc2 = GapMapPtr->second.first;
4935 int VLoc2 = GapMapPtr->second.second;
4938 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
4942 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
4946 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
4950 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
4968 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
4969 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
4979 bool FoundFlag =
false;
4991 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
4992 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
4993 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5014 bool FoundFlag =
false;
5027 TrackMapKeyPair.first = TrackElement.
HLoc;
5028 TrackMapKeyPair.second = TrackElement.
VLoc;
5029 TrackMapEntry.first = TrackMapKeyPair;
5034 LocationNameEntry.second = -(int)(
TrackVector.size());
5066 TrackMapKeyPair.first = HLoc;
5067 TrackMapKeyPair.second = VLoc;
5068 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5078 return TrackMapPtr->second;
5091 TrackMapKeyPair.first = HLoc;
5092 TrackMapKeyPair.second = VLoc;
5093 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5096 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5097 throw Exception(Message);
5112 THVPair InactiveTrackMapKeyPair;
5115 InactiveTrackMapKeyPair.first = HLoc;
5116 InactiveTrackMapKeyPair.second = VLoc;
5120 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5121 throw Exception(Message);
5135 bool Present =
true;
5139 TrackMapKeyPair.first = HLoc;
5140 TrackMapKeyPair.second = VLoc;
5141 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5156 bool Present =
true;
5157 THVPair InactiveTrackMapKeyPair;
5160 InactiveTrackMapKeyPair.first = HLoc;
5161 InactiveTrackMapKeyPair.second = VLoc;
5179 THVPair InactiveTrackMapKeyPair;
5184 InactiveTrackMapKeyPair.first = HLoc;
5185 InactiveTrackMapKeyPair.second = VLoc;
5194 if(InactiveTrackRange.first == InactiveTrackRange.second)
5203 RetPair.first = InactiveTrackRange.first->second;
5204 RetPair.second = (--InactiveTrackRange.second)->second;
5217 AnsiString(DivergingPosition));
5228 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5229 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5230 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5231 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5232 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5233 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5234 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5235 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5236 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5237 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5238 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5239 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5273 throw Exception(
"Error, Wrong track type in PlotGap");
5275 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5279 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5283 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5287 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5291 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5295 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5299 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5303 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5307 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5311 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5315 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5319 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5323 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5327 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5331 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5335 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
5349 throw Exception(
"Error, Wrong track type in PlotPoints");
5360 else if(TrackElement.
SpeedTag < 132)
5378 else if(TrackElement.
SpeedTag < 132)
5410 throw Exception(
"Error, Wrong track type in PlotSignal");
5412 for(
int x = 0; x < 40; x++)
5483 for(
int x = 0; x < 40; x++)
5490 Graphics::TBitmap* SignalPlatformGraphic;
5577 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
5585 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
5593 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
5601 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
5619 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
5621 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5623 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
5626 if(BaseElementSpeedTag == 1)
5630 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
5637 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
5645 Graphics::TBitmap *RouteGraphic;
5660 if(UpStep == DownStep)
5663 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
5666 else if((DownStep - UpStep) == 1)
5671 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
5674 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5680 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5683 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
5692 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
5695 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5698 else if(DownStep == 0)
5701 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5704 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
5710 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5713 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5716 for(
int x = (UpStep + 1); x < DownStep; x++)
5720 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
5722 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
5735 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
5742 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
5748 Graphics::TBitmap *RouteGraphic;
5765 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
5768 else if((RStep - LStep) == 1)
5773 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
5776 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5782 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5785 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
5794 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
5797 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5803 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5806 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
5812 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5815 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5818 for(
int x = (LStep + 1); x < RStep; x++)
5822 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
5824 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
5840 AnsiString(HLoc) +
"," + AnsiString(VLoc));
5843 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
5845 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5847 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
5850 if(BaseElementSpeedTag == 1)
5854 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
5861 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
5867 if(UpStep == DownStep)
5871 else if((DownStep - UpStep) == 1)
5880 for(
int x = (UpStep + 1); x < DownStep; x++)
5886 for(
int x = UpStep; x <= DownStep; x++)
5899 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
5906 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
5916 else if((RStep - LStep) == 1)
5925 for(
int x = (LStep + 1); x < RStep; x++)
5931 for(
int x = LStep; x <= RStep; x++)
5950 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
5952 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5954 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
5957 if(BaseElementSpeedTag == 1)
5961 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
5968 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
5974 for(
int x = UpStep; x < (DownStep + 1); x++)
5989 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
5996 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
6002 for(
int x = LStep; x < (RStep + 1); x++)
6021 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6024 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6026 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6028 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6033 if(BaseElementSpeedTag == 1)
6037 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
6044 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
6050 for(
int x = UpStep; x <= DownStep; x++)
6064 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
6071 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
6077 for(
int x = LStep; x <= RStep; x++)
6093 Graphics::TBitmap *RouteGraphic;
6094 Graphics::TBitmap *BaseGraphic;
6096 if(BaseElementSpeedTag == 1)
6108 RouteGraphic = BaseGraphic;
6122 RouteGraphic = BaseGraphic;
6126 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
6130 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6132 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6138 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
6141 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6146 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
6150 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
6152 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
6158 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
6161 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
6286 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
6290 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
6321 "," + AnsiString(VLoc));
6325 int DummyRouteNumber;
6327 TrainPresent =
false;
6331 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
6333 TrackMapKeyPair.first = HLoc;
6334 TrackMapKeyPair.second = VLoc + UpStep;
6335 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6344 TrainPresent =
true;
6353 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
6355 TrackMapKeyPair.first = HLoc;
6356 TrackMapKeyPair.second = VLoc + DownStep;
6357 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6366 TrainPresent =
true;
6375 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
6377 TrackMapKeyPair.first = HLoc + LeftStep;
6378 TrackMapKeyPair.second = VLoc;
6379 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6388 TrainPresent =
true;
6397 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
6399 TrackMapKeyPair.first = HLoc + RightStep;
6400 TrackMapKeyPair.second = VLoc;
6401 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6410 TrainPresent =
true;
6427 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
6434 else if(TrackElement.
SpeedTag < 132)
6452 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
6469 AnsiString(ScreenPosV));
6484 AnsiString(ScreenPosV));
6495 AnsiString(VPosTrue));
6509 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
6521 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
6522 " in TrackMap, Caller=" + (AnsiString)Caller);
6524 if(MapVecPos != (
int)a)
6526 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
6527 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
6528 (AnsiString)Caller);
6534 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
6535 " Caller=" + (AnsiString)Caller);
6555 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
6556 " in InactiveMap, Caller=" + (AnsiString)Caller);
6558 if((InactivePair.first != a) && (InactivePair.second != a))
6560 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
6561 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
6562 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
6567 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
6568 " Caller=" + (AnsiString)Caller);
6578 int Position1, Position2;
6584 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
6586 int HLoc1 = GapMapPtr->first.first;
6587 int VLoc1 = GapMapPtr->first.second;
6588 int HLoc2 = GapMapPtr->second.first;
6589 int VLoc2 = GapMapPtr->second.second;
6592 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
6596 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
6600 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
6604 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
6608 unsigned int GapCount = 0;
6610 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
6616 if((
GapMap.size() * 2) != GapCount)
6618 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
6619 (AnsiString)Caller);
6629 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
6633 throw Exception(
"Error - TrackFinished with erase element still present");
6638 AnsiString IDString;
6640 if(TrackElement.
HLoc < 0)
6641 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
6643 IDString = AnsiString(TrackElement.
HLoc) +
"-";
6644 if(TrackElement.
VLoc < 0)
6645 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
6647 IDString += AnsiString(TrackElement.
VLoc);
6660 for(
int x = 1; x < String.Length() + 1; x++)
6662 if(String.IsDelimiter(
"-", x))
6667 if(x == String.Length())
6670 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
6678 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
6682 if(DelimPos == String.Length())
6685 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
6689 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
6692 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
6698 if(String.SubString(1, 1) !=
"N")
6700 for(
int x = 1; x < DelimPos; x++)
6702 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6705 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
6711 if(String.SubString(1, 1) ==
"N")
6713 for(
int x = 2; x < DelimPos; x++)
6715 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6718 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
6724 if(String.SubString(1, 1) ==
"N")
6725 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
6727 HLoc = String.SubString(1, DelimPos - 1).ToInt();
6729 if(String.SubString(DelimPos + 1, 1) !=
"N")
6731 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
6733 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6736 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
6742 if(String.SubString(DelimPos + 1, 1) ==
"N")
6744 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
6746 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6749 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
6755 if(String.SubString(DelimPos + 1, 1) ==
"N")
6756 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
6758 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
6763 TrackMapPtr =
TrackMap.find(HVPair);
6767 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
6772 return TrackMapPtr->second;
6783 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
6784 int HLoc = TrackElement.
HLoc;
6785 int VLoc = TrackElement.
VLoc;
6888 AnsiString(SpeedTag));
6899 if(HVRange.first == HVRange.second)
6905 HVIt1 = HVRange.first;
6909 if(--HVRange.second != HVRange.first)
6911 HVIt2 = HVRange.second;
6915 HVIt2->second).
SpeedTag == SpeedTag)))
6935 AnsiString(SpeedTag));
7001 AnsiString TestString1, TestString2;
7006 throw Exception(
"LNPendingList size not 1 on entry");
7012 int H = CurrentElement->HLoc;
7013 int V = CurrentElement->VLoc;
7014 int Tag = CurrentElement->SpeedTag;
7020 for(
int x = 0; x < 25; x++)
7030 for(
int x = 0; x < 25; x++)
7040 for(
int x = 0; x < 25; x++)
7050 for(
int x = 0; x < 25; x++)
7060 for(
int x = 0; x < 28; x++)
7070 for(
int x = 0; x < 8; x++)
7080 for(
int x = 0; x < 8; x++)
7090 for(
int x = 0; x < 4; x++)
7100 for(
int x = 0; x < 8; x++)
7110 for(
int x = 0; x < 8; x++)
7126 if((ExistingName !=
"") && (ExistingName != LocationName))
7140 AddName(1, CurrentElement, LocationName);
7144 LNDone2MultiMapEntry.first = HVPair;
7155 bool FoundFlag, ErasedFlag =
false;
7157 if(SNRange.first != SNRange.second)
7161 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
7168 TVIt->LocationName =
"";
7169 TVIt->ActiveTrackElementName =
"";
7204 AnsiString(SpeedTag));
7214 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
7221 int MapPos = -1 - Position;
7225 FoundElement = MapPos;
7241 FoundElement = IMPair.first;
7250 FoundElement = IMPair.second;
7271 AnsiString OldName = TrackElement->LocationName, ErrorString;
7273 TrackElement->LocationName = Name;
7274 int HLoc = TrackElement->HLoc;
7275 int VLoc = TrackElement->VLoc;
7289 if(ErrorString !=
"")
7291 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
7315 if(LNDone2MultiMapIterator->second == MapPos)
7342 if(*LNPendingListIterator == MapPos)
7408 if(LocationName ==
"")
7419 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7424 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
7425 ActiveTrackElementNameMapEntry.second = 0;
7447 bool FoundFlag, ErasedFlag =
false;
7451 if(SNRange.first != SNRange.second)
7454 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
7457 TVIt->LocationName =
"";
7458 TVIt->ActiveTrackElementName =
"";
7490 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
7492 AnsiString LocationName;
7497 for(
int x = 0; x < 25; x++)
7507 else if(SpeedTag == 77)
7509 for(
int x = 0; x < 25; x++)
7519 else if(SpeedTag == 78)
7521 for(
int x = 0; x < 25; x++)
7531 else if(SpeedTag == 79)
7533 for(
int x = 0; x < 25; x++)
7543 else if(SpeedTag == 96)
7545 for(
int x = 0; x < 28; x++)
7555 else if(SpeedTag == 129)
7557 for(
int x = 0; x < 8; x++)
7567 else if(SpeedTag == 130)
7569 for(
int x = 0; x < 8; x++)
7579 else if(SpeedTag == 145)
7581 for(
int x = 0; x < 8; x++)
7591 else if(SpeedTag == 146)
7593 for(
int x = 0; x < 8; x++)
7603 else if(SpeedTag == 131)
7605 for(
int x = 0; x < 4; x++)
7628 AnsiString(SpeedTag));
7640 if(TempElement->LocationName !=
"")
7642 LocationName = TempElement->LocationName;
7643 FoundElement = IMPair.first;
7651 if(TempElement->LocationName !=
"")
7653 LocationName = TempElement->LocationName;
7654 FoundElement = IMPair.second;
7667 if(TempElement->LocationName !=
"")
7669 LocationName = TempElement->LocationName;
7670 FoundElement = -1 - Position;
7686 unsigned int Count = 0;
7694 AnsiString SName, TName, ErrorString;
7696 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7702 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
7703 AnsiString(Caller));
7716 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
7717 AnsiString(Caller));
7724 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
7725 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7731 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7737 if(ErrorString !=
"")
7739 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
7741 if(SNIt->second != -1 - (
int)x)
7743 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
7744 AnsiString(Caller));
7750 bool FoundFlag =
false;
7759 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
7760 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7764 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
7765 " & V " + AnsiString(
TrackVector.at(x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
7766 AnsiString(Caller));
7771 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
7772 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7782 if(ErrorString !=
"")
7784 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
7786 if(SNIt->second != (
int)x)
7788 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
7789 AnsiString(Caller));
7799 AnsiString &ErrorString)
7807 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
7809 bool FoundFlag =
false;
7813 if(SNRange.first == SNRange.second)
7815 ErrorString =
"Error, Name " + LocationName +
" not found in map";
7817 return SNRange.first;
7821 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
7823 if(SNIterator->second < 0)
7825 int TVPos = -1 - SNIterator->second;
7827 if(TVIt == TrackElement)
7836 int ITVPos = SNIterator->second;
7838 if(ITVIt == TrackElement)
7848 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
7864 LocationNameEntry.first = NewName;
7865 LocationNameEntry.second = SNIterator->second;
7879 int TruePos = -1 - Position;
7883 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
7893 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
7916 InactiveTrack2MultiMapIterator++)
7918 if(InactiveTrack2MultiMapIterator->second > VecPos)
7919 InactiveTrack2MultiMapIterator->second--;
7926 LocationNameMultiMapIterator++)
7928 if(LocationNameMultiMapIterator->second < 0)
7930 if(LocationNameMultiMapIterator->second > (
int)VecPos)
7931 LocationNameMultiMapIterator->second--;
7952 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
7954 if(TrackMapIterator->second > VecPos)
7955 TrackMapIterator->second--;
7962 LocationNameMultiMapIterator++)
7964 if(LocationNameMultiMapIterator->second >= 0)
7968 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
7969 LocationNameMultiMapIterator->second++;
7972 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7978 if(TkEl.
Conn[0] ==
int(VecPos))
7983 if(TkEl.
Conn[0] >
int(VecPos))
7985 if(TkEl.
Conn[0] > -1)
8009 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
8015 LocationNameEntry.second = -1 - TVPos;
8026 LocationNameEntry.second = ITVPos;
8068 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8100 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8124 AnsiString((
short)FirstTrack));
8125 bool LengthDifferent =
false, SpeedDifferent =
false;
8133 int EXArray[16][2] =
8135 {2, 4}, {6, 2}, {8, 6}, {4, 8},
8136 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
8139 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
8140 Graphics::TBitmap *Bitmap;
8144 InLink = TrackElement.
Link[0];
8145 OutLink = TrackElement.
Link[1];
8149 InLink = TrackElement.
Link[2];
8150 OutLink = TrackElement.
Link[3];
8153 for(
int x = 0; x < 16; x++)
8155 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
8160 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
8178 else if(TrackElement.
SpeedTag == 54)
8180 else if(TrackElement.
SpeedTag == 55)
8187 else if(TrackElement.
SpeedTag == 58)
8189 else if(TrackElement.
SpeedTag == 59)
8192 else if(Index == 14)
8196 else if(TrackElement.
SpeedTag == 52)
8198 else if(TrackElement.
SpeedTag == 57)
8201 else if(Index == 15)
8205 else if(TrackElement.
SpeedTag == 53)
8207 else if(TrackElement.
SpeedTag == 56)
8217 if(LengthDifferent && SpeedDifferent)
8258 else if(LengthDifferent && !SpeedDifferent)
8352 AnsiString((
short)FirstTrack));
8353 LengthDifferent =
false;
8354 SpeedDifferent =
false;
8359 LengthDifferent =
true;
8363 SpeedDifferent =
true;
8365 if(LengthDifferent || SpeedDifferent)
8378 LengthDifferent =
true;
8382 SpeedDifferent =
true;
8384 if(LengthDifferent || SpeedDifferent)
8397 LengthDifferent =
true;
8401 SpeedDifferent =
true;
8403 if(LengthDifferent || SpeedDifferent)
8483 AnsiString TempName;
8484 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
8485 bool ForwardSet, ReverseSet;
8487 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8492 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8530 for(
int y = 0; y < 2; y++)
8561 StartElement = TempElement;
8562 StartVecPos = VecPos;
8566 StartEntryPos = 1 - Dir;
8575 VecPos = TempElement.
Conn[1 - EntryPos];
8576 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
8578 EntryPos = TempEntryPos;
8606 ForwardNumber = ((Count + 1) / 2) + 1;
8607 ReverseNumber = (Count - ForwardNumber) + 1;
8610 TempElement = StartElement;
8611 VecPos = StartVecPos;
8612 if(Count == ForwardNumber)
8617 if(Count == ReverseNumber)
8625 VecPos = TempElement.
Conn[1 - EntryPos];
8626 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
8628 EntryPos = TempEntryPos;
8630 if(Count == ForwardNumber)
8635 if(Count == ReverseNumber)
8647 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8649 if(
TrackVector.at(x).StationEntryStopLinkPos1 == 5)
8653 if(
TrackVector.at(x).StationEntryStopLinkPos2 == 5)
8761 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8797 if((TextH / 16) - 1 <
HLocMin)
8799 if((TextH / 16) + 1 >
HLocMax)
8801 if((TextV / 16) - 1 <
VLocMin)
8803 if((TextV / 16) + 1 >
VLocMax)
8823 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
8824 bool &UserGraphicFoundFlag)
8827 TUserGraphicVector::iterator UserGraphicPtr;
8829 UserGraphicFoundFlag =
false;
8836 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
8837 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
8839 UserGraphicItem = x;
8840 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
8841 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
8842 UserGraphicFoundFlag =
true;
8858 int SpeedTag = TrackElement.
SpeedTag;
8862 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
8911 return GraphicOutput;
8919 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
8921 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
8934 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
8935 " in InactiveTrackElementAt");
8946 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
8948 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
8973 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
8974 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
8978 if(SNRange.first == SNRange.second)
8983 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8985 if(SNIterator->second < 0)
8991 HVPair.first = InactiveElement.
HLoc;
8992 HVPair.second = InactiveElement.
VLoc;
8996 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
8998 int TVPos =
TrackMap.find(HVPair)->second;
9001 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
9007 FirstNamedExitPos = 0;
9011 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9012 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9015 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9017 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
9018 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9019 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9022 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9032 FirstNamedExitPos = 1;
9036 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9037 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9040 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9042 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
9043 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9044 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9047 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9062 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
9076 AnsiString(FirstNamedElementPos));
9077 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
9078 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
9080 SecondNamedElementPos = -1;
9081 FirstNamedLinkedElementPos = -1;
9082 SecondNamedLinkedElementPos = -1;
9086 if(SNRange.first == SNRange.second)
9091 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9093 if(SNIterator->second < 0)
9099 HVPair.first = InactiveElement.
HLoc;
9100 HVPair.second = InactiveElement.
VLoc;
9112 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
9116 int TVPos =
TrackMap.find(HVPair)->second;
9117 if(TVPos != FirstNamedElementPos)
9121 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
9127 FirstNamedExitPos = 0;
9131 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9132 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9135 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9137 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
9138 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9139 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9142 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9144 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
9145 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
9146 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
9155 FirstNamedExitPos = 1;
9159 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9160 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9163 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9165 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
9166 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9167 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9170 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9172 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
9173 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
9174 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
9194 if(SNRange.first != SNRange.second)
9196 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9198 if(SNIterator->second < 0)
9218 "," + AnsiString(SpeedTag));
9229 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
9255 else if(SpeedTag == 69)
9277 else if(SpeedTag == 70)
9299 else if(SpeedTag == 71)
9332 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
9333 if(NextEntryPos < 0)
9346 if(NextEntryPos > 1)
9365 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
9377 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
9378 bool FoundFlag =
false;
9393 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
9394 bool FoundFlag =
false;
9413 VPosHi = 16 * VLocHi;
9414 VPosLo = 16 * VLocLo;
9433 AnsiString(EndTVPosition));
9444 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
9445 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
9446 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
9447 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
9449 if(Link0Squares <= Link1Squares)
9466 AnsiString(LinkPos));
9485 if((LinkPos == 1) && (TE.
Attribute == 0))
9490 else if(LinkPos == 1)
9496 else if((LinkPos == 3) && (TE.
Attribute == 1))
9501 else if(LinkPos == 3)
9508 else if(LinkPos == 0)
9513 else if(LinkPos == 1)
9518 else if(LinkPos == 2)
9523 else if(LinkPos == 3)
9528 throw Exception(
"Error, failure in GetExitPos");
9577 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
9581 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
9620 "," + AnsiString(DiagonalLinkNumber));
9625 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
9631 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
9637 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
9643 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
9660 AnsiString JustFileName =
"";
9665 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
9672 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
9688 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
9705 throw Exception(
"Return value negative in call to LastElementNumber");
9717 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
9731 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
9743 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
9744 " in GetModifiablePrefDirElementAt");
9754 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
9756 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
9766 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
9768 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
9785 int TrackVectorPosition;
9837 FinishElement =
false;
9838 int TrackVectorPosition;
9861 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
9872 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
9895 for(
int x = 0; x < 4; x++)
9918 FinishElement =
true;
9926 for(
int x = 0; x < 4; x++)
9938 FinishElement =
true;
9946 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
9953 .ELinkPos] ==
Lead))
9969 FinishElement =
true;
9988 FinishElement =
true;
10007 FinishElement =
true;
10022 FinishElement =
true;
10031 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
10047 FinishElement =
true;
10053 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
10076 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
10077 int VectorCount = 0;
10081 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
10083 for(
int x = 0; x < VectorCount; x++)
10088 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
10092 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
10093 SearchElement.
ELinkPos = NextELinkPos;
10106 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
10108 SearchElement.
XLinkPos = NextXLinkPos;
10134 for(
int x = 0; x < VectorCount; x++)
10144 for(
int x = 0; x < VectorCount; x++)
10156 for(
int x = 0; x < VectorCount; x++)
10168 for(
int x = 0; x < VectorCount; x++)
10177 for(
int x = 0; x < VectorCount; x++)
10186 SearchElement.
XLink = SearchElement.
Link[1];
10205 SearchElement.
XLink = SearchElement.
Link[3];
10218 for(
int x = 0; x < VectorCount; x++)
10230 XLinkPos = NextXLinkPos;
10231 CurrentTrackElement = SearchElement;
10250 throw Exception(
"Error, SearchVector empty");
10257 for(
int x = 0; x < 4; x++)
10302 throw Exception(
"Error in EntryExitNumber 1");
10322 if(PrefDirElement.
XLink == -1)
10330 if(PrefDirElement.
XLink != -1)
10334 throw Exception(
"Error in EntryExitNumber 2");
10370 LeadingPoints =
false;
10398 LeadingPoints =
true;
10414 AnsiString ErrorString;
10415 bool Error =
false;
10422 ErrorString =
"HLoc";
10428 ErrorString =
"VLoc";
10434 ErrorString =
"ELink";
10440 ErrorString =
"ELinkPos";
10446 ErrorString =
"XLink";
10452 ErrorString =
"XLinkPos";
10458 ErrorString =
"Tag";
10464 ErrorString =
"TrackVectorPosition";
10470 ErrorString =
"EXNumber";
10477 ErrorString =
"CheckCount";
10484 ErrorString =
"EntryGraphicPtr";
10490 ErrorString =
"EntryDirectionGraphicPtr";
10499 ErrorString =
"Last XLink not connected to this element";
10506 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
10530 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
10587 AnsiString((
short)BuildingPrefDir));
10590 if(PrefDirSize() == 0)
10595 for(
unsigned int x = 0; x < PrefDirSize(); x++)
10607 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
10619 if(x == (PrefDirSize() - 1))
10628 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
10630 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
10631 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
10632 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
10634 if(PrefDirSize() > 1)
10636 unsigned int LatestPos = PrefDirSize() - 1;
10637 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
10638 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
10639 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
10661 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
10664 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
10668 H = MMIT->first.first;
10669 V = MMIT->first.second;
10672 if(PrefDirPos0 > -1)
10674 if(PrefDirPos1 > -1)
10676 if(PrefDirPos2 > -1)
10678 if(PrefDirPos3 > -1)
10680 if(PrefDirPos3 > -1)
10695 else if(PrefDirPos2 > -1)
10734 else if(PrefDirPos1 > -1)
10755 else if(PrefDirPos0 > -1)
10774 int NumberOfPrefDirElements = 0;
10777 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10779 VecFile >> TempInt;
10782 VecFile >> TempInt;
10783 LoadPrefDirElement.
ELink = TempInt;
10784 VecFile >> TempInt;
10785 LoadPrefDirElement.
ELinkPos = TempInt;
10786 VecFile >> TempInt;
10787 LoadPrefDirElement.
XLink = TempInt;
10788 VecFile >> TempInt;
10789 LoadPrefDirElement.
XLinkPos = TempInt;
10790 VecFile >> TempInt;
10791 LoadPrefDirElement.
EXNumber = TempInt;
10792 VecFile >> TempInt;
10797 if(!(LoadPrefDirElement.
IsARoute))
10823 int NumberOfPrefDirElements = 0;
10826 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10828 VecFile >> TempInt;
10829 VecFile >> TempInt;
10832 VecFile >> TempInt;
10833 LoadPrefDirElement.
ELink = TempInt;
10834 VecFile >> TempInt;
10835 LoadPrefDirElement.
ELinkPos = TempInt;
10836 VecFile >> TempInt;
10837 LoadPrefDirElement.
XLink = TempInt;
10838 VecFile >> TempInt;
10839 LoadPrefDirElement.
XLinkPos = TempInt;
10840 VecFile >> TempInt;
10841 LoadPrefDirElement.
EXNumber = TempInt;
10842 VecFile >> TempInt;
10847 if(!(LoadPrefDirElement.
IsARoute))
10875 int NumberOfPrefDirElements = 0;
10878 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
10883 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10890 VecFile >> TempInt;
10891 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
10896 VecFile >> TempInt;
10897 if((TempInt < -1) || (TempInt > 9))
10902 VecFile >> TempInt;
10903 if((TempInt < -1) || (TempInt > 3))
10908 VecFile >> TempInt;
10909 if((TempInt < -1) || (TempInt > 9))
10914 VecFile >> TempInt;
10915 if((TempInt < -1) || (TempInt > 3))
10920 VecFile >> TempInt;
10921 if((TempInt < -1) || (TempInt > 27))
10926 VecFile >> TempInt;
10934 VecFile >> TempInt;
10935 if((TempInt != 0) && (TempInt != 1))
10940 VecFile >> TempInt;
10941 if((TempInt != 0) && (TempInt != 1))
10946 VecFile >> TempInt;
10947 if((TempInt != 0) && (TempInt != 1))
10970 for(
int y = 0; y < NumberOfPrefDirElements; y++)
10972 VecFile << y <<
'\n';
10973 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
10983 if(y == (NumberOfPrefDirElements - 1))
10985 VecFile <<
"************" <<
'\0' <<
'\n';
10989 VecFile <<
"******" <<
'\0' <<
'\n';
11003 for(
int y = 0; y < NumberOfSearchElements; y++)
11005 VecFile << y <<
'\n';
11006 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
11016 if(y == (NumberOfSearchElements - 1))
11018 VecFile <<
"************" <<
'\0' <<
'\n';
11022 VecFile <<
"******" <<
'\0' <<
'\n';
11127 bool AlreadyPresent, FoundFlag;
11128 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11130 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
11134 AlreadyPresent =
false;
11138 AlreadyPresent =
true;
11140 AlreadyPresent =
true;
11142 AlreadyPresent =
true;
11144 AlreadyPresent =
true;
11146 if(!AlreadyPresent)
11191 for(
unsigned int z = 0; z < 4; z++)
11199 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
11213 bool DiscrepancyFound =
false;
11223 DiscrepancyFound =
true;
11226 DiscrepancyFound =
true;
11231 DiscrepancyFound =
true;
11236 DiscrepancyFound =
true;
11241 DiscrepancyFound =
true;
11246 DiscrepancyFound =
true;
11248 if(DiscrepancyFound)
11250 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
11265 bool DiscrepancyFound =
false;
11275 DiscrepancyFound =
true;
11278 DiscrepancyFound =
true;
11283 DiscrepancyFound =
true;
11288 DiscrepancyFound =
true;
11293 DiscrepancyFound =
true;
11298 DiscrepancyFound =
true;
11301 return !DiscrepancyFound;
11313 bool FoundFlag =
false;
11314 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
11322 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
11323 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
11325 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
11327 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
11328 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
11329 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
11334 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
11335 +
" Caller=" + (AnsiString)Caller);
11361 PrefDirMapKeyPair.first = HLoc;
11362 PrefDirMapKeyPair.second = VLoc;
11363 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11366 if(ItPair.first == ItPair.second)
11374 PrefDirPos0 = ItPair.first->second;
11376 if(ItPair.first == ItPair.second)
11381 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11382 PrefDirPos1 = ItPair.first->second;
11384 if(ItPair.first == ItPair.second)
11389 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11390 PrefDirPos2 = ItPair.first->second;
11392 if(ItPair.first == ItPair.second)
11397 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11398 PrefDirPos3 = ItPair.first->second;
11412 THVPair PrefDir4MultiMapKeyPair;
11415 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
11416 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
11417 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
11440 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
11459 AnsiString(ErasedElementNumber));
11464 if(MapPtr->second > ErasedElementNumber)
11484 throw Exception(
"PrefDirVectorPosition out of range");
11487 THVPair PrefDir4MultiMapKeyPair;
11489 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
11490 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
11491 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11494 if(ItPair.first == ItPair.second)
11497 return ItPair.first;
11501 if(ItPair.first->second == PrefDirVectorPosition)
11505 return ItPair.first;
11508 if(ItPair.first == ItPair.second)
11511 return ItPair.first;
11513 if(ItPair.first->second == PrefDirVectorPosition)
11517 return ItPair.first;
11520 if(ItPair.first == ItPair.second)
11523 return ItPair.first;
11525 if(ItPair.first->second == PrefDirVectorPosition)
11529 return ItPair.first;
11532 if(ItPair.first == ItPair.second)
11535 return ItPair.first;
11537 if(ItPair.first->second == PrefDirVectorPosition)
11541 return ItPair.first;
11545 return ItPair.first;
11558 THVPair PrefDir4MultiMapKeyPair;
11560 PrefDir4MultiMapKeyPair.first = HLoc;
11561 PrefDir4MultiMapKeyPair.second = VLoc;
11562 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11565 if(ItPair.first == ItPair.second)
11573 return ItPair.first->second;
11582 bool ErasedFlag =
false;
11584 if(ErasedTrackVectorPosition > -1)
11593 ErasedFlag =
false;
11595 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
11600 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
11605 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
11610 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
11615 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
11623 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
11627 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
11631 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
11635 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
11639 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
11654 OverallDistance = 0;
11655 OverallSpeedLimit = 0;
11656 LeadingPointsAtLastElement =
false;
11665 LeadingPointsAtLastElement =
true;
11674 OverallDistance += PrefDirElement.
Length23;
11675 if(OverallSpeedLimit != -1)
11685 OverallSpeedLimit = -1;
11692 OverallDistance += PrefDirElement.
Length01;
11693 if(OverallSpeedLimit != -1)
11703 OverallSpeedLimit = -1;
11723 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11726 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
11730 HLoc = MMIT->first.first;
11731 VLoc = MMIT->first.second;
11736 if(PrefDirPos0 > -1)
11738 if(PrefDirPos1 > -1)
11740 if(PrefDirPos2 > -1)
11742 if(PrefDirPos3 > -1)
11744 if(PrefDirPos3 > -1)
11746 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11748 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11750 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11752 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
11759 else if(PrefDirPos2 > -1)
11763 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11765 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11767 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
11775 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11777 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11779 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
11787 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11789 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11791 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11798 else if(PrefDirPos1 > -1)
11802 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11804 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11811 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11813 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
11819 else if(PrefDirPos0 > -1)
11821 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11838 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11841 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
11862 if(PrefDirPos0 > -1)
11864 if(PrefDirPos1 > -1)
11866 if(PrefDirPos2 > -1)
11868 if(PrefDirPos3 > -1)
11871 if(PrefDirPos3 > -1)
11876 else if(PrefDirPos2 > -1)
11878 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
11889 else if(PrefDirPos1 > -1)
11891 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
11902 else if(PrefDirPos0 > -1)
11904 if(PrefDirElement0.
XLinkPos == EntryPos)
11941 ElementIn.
VLoc +
"," + XLink);
11943 bool TrackFoundFlag;
11946 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
11959 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
11969 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
11984 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
11994 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
12009 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
12019 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
12034 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
12044 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
12067 bool FoundFlag, ContFlag, FoundElements =
false;
12068 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12073 LastIteratorValue++;
12094 if(PDVIt->XLinkPos == 0)
12099 StartElement = *PDVIt;
12108 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
12110 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12111 if(PrefDirPos0 == -1)
12115 bool NextElementFoundFlag =
false;
12119 NextElementFoundFlag =
true;
12121 if(PrefDirPos1 > -1)
12126 NextElementFoundFlag =
true;
12129 if(PrefDirPos2 > -1)
12134 NextElementFoundFlag =
true;
12137 if(PrefDirPos3 > -1)
12142 NextElementFoundFlag =
true;
12145 if(!NextElementFoundFlag)
12175 EndElement = NextElement;
12179 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
12181 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12182 if(PrefDirPos0 == -1)
12192 if(PrefDirPos1 > -1)
12200 if(PrefDirPos2 > -1)
12208 if(PrefDirPos3 > -1)
12237 FoundElements =
true;
12301 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
12303 int TrackVectorPosition;
12312 if(ConsecSignalsRoute)
12355 int LockedVectorNumber;
12379 bool InPrefDirFlag =
false;
12382 int PrefDirPos0 = -1;
12383 int PrefDirPos1 = -1;
12384 int PrefDirPos2 = -1;
12385 int PrefDirPos3 = -1;
12389 int PrefDirVecPos[4] =
12390 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
12392 for(
int x = 0; x < 4; x++)
12394 int b = PrefDirVecPos[x];
12397 if(ConsecSignalsRoute)
12406 InPrefDirFlag =
true;
12424 InPrefDirFlag =
true;
12430 InPrefDirFlag =
true;
12443 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
12452 if(DummyPair.first > -1)
12454 throw Exception(
"Selection in two routes - should never happen!");
12457 if(RoutePair.first > -1)
12487 if(ConsecSignalsRoute)
12537 IDInt &ReqPosRouteID,
bool &PointsChanged)
12577 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
12616 if(ConsecSignalsRoute)
12645 bool InPrefDirFlag =
false;
12648 int PrefDirPos0 = -1;
12649 int PrefDirPos1 = -1;
12650 int PrefDirPos2 = -1;
12651 int PrefDirPos3 = -1;
12654 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12655 int PrefDirVecPos[4] =
12656 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
12658 for(
int x = 0; x < 4; x++)
12660 int b = PrefDirVecPos[x];
12663 InPrefDirFlag =
true;
12673 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
12683 if(RoutePair.first > -1)
12685 if(RoutePair.second != 0)
12702 EndElement1 = RouteElement;
12703 EndElement2 = BlankElement;
12808 PointsChanged =
true;
12833 PointsChanged =
true;
12854 PointsChanged =
true;
12882 PointsChanged =
true;
12896 PointsChanged =
true;
12912 PointsChanged =
true;
12923 PointsChanged =
true;
12939 PointsChanged =
true;
12991 TOnePrefDir *EveryPrefDir,
bool ConsecSignalsRoute,
int EndPosition,
bool AutoSigsFlag)
13044 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
13045 AnsiString((
short)AutoSigsFlag));
13046 int VectorCount = 0;
13050 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
13054 for(
int x = 0; x < VectorCount; x++)
13061 bool FirstPass =
true;
13071 for(
int x = 0; x < VectorCount; x++)
13078 for(
int x = 0; x < VectorCount; x++)
13083 if(!FirstPass && (ConsecSignalsRoute) && (PrefDirElement.
Config[PrefDirElement.
XLinkPos] ==
Signal))
13088 for(
int x = 0; x < VectorCount; x++)
13094 int NextPosition = PrefDirElement.
Conn[XLinkPos];
13098 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
13099 SearchElement.
ELinkPos = NextELinkPos;
13100 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
13113 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
13115 SearchElement.
XLinkPos = NextXLinkPos;
13127 for(
int x = 0; x < VectorCount; x++)
13139 if(RoutePair.first > -1)
13148 for(
int x = 0; x < VectorCount; x++)
13155 if(SecondPair.first > -1)
13164 for(
int x = 0; x < VectorCount; x++)
13177 for(
int x = 0; x < VectorCount; x++)
13186 for(
int x = 0; x < VectorCount; x++)
13193 for(
int x = 0; x < VectorCount; x++)
13201 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13205 for(
int x = 0; x < VectorCount; x++)
13213 bool InPrefDirFlag =
false;
13214 PrefDirElement1 = BlankElement;
13215 PrefDirElement2 = BlankElement;
13218 int PrefDirPos0 = -1;
13219 int PrefDirPos1 = -1;
13220 int PrefDirPos2 = -1;
13221 int PrefDirPos3 = -1;
13224 int PrefDirVecPos[4] =
13225 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
13226 for(
int x = 0; x < 4; x++)
13228 int b = PrefDirVecPos[x];
13231 InPrefDirFlag =
true;
13240 for(
int x = 0; x < VectorCount; x++)
13251 for(
int x = 0; x < VectorCount; x++)
13264 for(
int x = 0; x < VectorCount; x++)
13273 if(ConsecSignalsRoute)
13284 for(
int x = 0; x < VectorCount; x++)
13298 for(
int x = 0; x < VectorCount; x++)
13306 for(
int x = 0; x < VectorCount; x++)
13315 int SearchPos1 = SearchElement.
Attribute + 1;
13317 if(SearchPos1 == 2)
13319 if(SearchPos1 == 1)
13323 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
13324 SearchElement.
XLinkPos = SearchPos1;
13325 InPrefDirFlag =
false;
13326 if(SearchElement.
XLink == PrefDirElement1.
XLink)
13328 SearchElement = PrefDirElement1;
13329 InPrefDirFlag =
true;
13331 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
13333 SearchElement = PrefDirElement2;
13334 InPrefDirFlag =
true;
13340 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13344 for(
int x = 0; x < VectorCount; x++)
13354 if(ConsecSignalsRoute)
13372 for(
int x = 0; x < VectorCount; x++)
13388 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
13389 SearchElement.
XLinkPos = SearchPos2;
13390 if(SearchElement.
XLink == PrefDirElement1.
XLink)
13392 SearchElement = PrefDirElement1;
13394 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
13396 SearchElement = PrefDirElement2;
13400 for(
int x = 0; x < VectorCount; x++)
13406 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13410 for(
int x = 0; x < VectorCount; x++)
13421 if(ConsecSignalsRoute)
13439 for(
int x = 0; x < VectorCount; x++)
13449 for(
int x = 0; x < VectorCount; x++)
13456 SearchElement = PrefDirElement1;
13461 if(ConsecSignalsRoute)
13468 XLinkPos = SearchElement.
XLinkPos;
13469 PrefDirElement = SearchElement;
13526 unsigned int TruncatePrefDirPosition = 0;
13600 throw Exception(
"Error - failed to validate extended route for preferred route");
13656 throw Exception(
"Error - failed to validate single route for preferred route");
13705 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
13707 int TrackVectorPosition;
13743 int LockedVectorNumber;
13774 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
13775 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
13778 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
13784 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
13785 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
13788 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
13802 if(RoutePair.first > -1)
13986 EndElement1.
ELink = EndElement1.
Link[0];
13987 EndElement1.
XLink = EndElement1.
Link[1];
13990 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
13995 EndElement2.
ELink = EndElement2.
Link[1];
13996 EndElement2.
XLink = EndElement2.
Link[0];
13999 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
14045 if(RoutePair.first > -1)
14047 if(RoutePair.second != 0)
14066 EndElement2 = BlankElement;
14145 PointsChanged =
true;
14169 PointsChanged =
true;
14189 PointsChanged =
true;
14213 PointsChanged =
true;
14227 PointsChanged =
true;
14265 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
14266 int VectorCount = 0;
14269 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
14270 (CurrentTrackElement.
Link[XLinkPos] == 9))
14274 for(
int x = 0; x < VectorCount; x++)
14285 for(
int x = 0; x < VectorCount; x++)
14290 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
14292 for(
int x = 0; x < VectorCount; x++)
14297 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
14301 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
14302 SearchElement.
ELinkPos = NextELinkPos;
14315 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
14317 SearchElement.
XLinkPos = NextXLinkPos;
14330 for(
int x = 0; x < VectorCount; x++)
14342 if(RoutePair.first > -1)
14351 for(
int x = 0; x < VectorCount; x++)
14358 if(SecondPair.first > -1)
14367 for(
int x = 0; x < VectorCount; x++)
14380 for(
int x = 0; x < VectorCount; x++)
14389 for(
int x = 0; x < VectorCount; x++)
14396 for(
int x = 0; x < VectorCount; x++)
14404 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14408 for(
int x = 0; x < VectorCount; x++)
14420 for(
int x = 0; x < VectorCount; x++)
14447 for(
int x = 0; x < VectorCount; x++)
14456 for(
int x = 0; x < VectorCount; x++)
14466 int SearchPos1 = SearchElement.
Attribute + 1;
14468 if(SearchPos1 == 2)
14470 if(SearchPos1 == 1)
14475 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
14476 SearchElement.
XLinkPos = SearchPos1;
14478 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14482 for(
int x = 0; x < VectorCount; x++)
14505 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
14506 SearchElement.
XLinkPos = SearchPos2;
14508 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14512 for(
int x = 0; x < VectorCount; x++)
14529 for(
int x = 0; x < VectorCount; x++)
14541 CurrentTrackElement = SearchElement;
14542 XLinkPos = SearchElement.
XLinkPos;
14564 throw Exception(
"Error, SearchVector empty");
14576 for(
int x = 0; x < 4; x++)
14610 throw Exception(
"Error in EntryExitNumber 3");
14666 unsigned int TruncatePrefDirPosition = 0;
14727 throw Exception(
"Failed to validate extended route for nonpreferred route");
14773 throw Exception(
"Failed to validate single route for nonpreferred route");
14793 if(!PrefDirVector.empty())
14797 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
14802 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
14837 if(!PrefDirVector.empty())
14840 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
14842 int ForwardLinkedRouteNumber, Attribute = 0;
14849 if(ForwardLinkedRouteNumber > -1)
14851 int NextForwardLinkedRouteNumber = -1;
14855 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
14865 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
14884 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
14892 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
14923 NextForwardLinkedRouteNumber = -1;
14924 for(
unsigned int x = 0; x < PrefDirSize(); x++)
14926 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
14927 if(PrefDirVector.at(x).TrackType ==
Bridge)
14929 if(PrefDirVector.at(x).XLinkPos < 2)
14930 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
14932 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
14939 if(PrefDirVector.at(x).TrackType ==
Buffers)
14951 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
14960 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
14962 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
14968 if(x == PrefDirSize() - 1)
15010 AnsiString(PrefDirVectorStartPosition));
15015 bool SkipContinuationAndBufferAttributeChange =
false;
15017 if(!PrefDirVector.empty())
15019 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
15022 if(PrefDirPtr->TrackType ==
Bridge)
15024 if(PrefDirPtr->XLinkPos < 2)
15031 SkipContinuationAndBufferAttributeChange =
true;
15046 SkipContinuationAndBufferAttributeChange =
true;
15054 SkipContinuationAndBufferAttributeChange =
true;
15056 if(!SkipContinuationAndBufferAttributeChange)
15058 if(PrefDirVector.back().TrackType ==
Buffers)
15064 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
15067 if(PrefDirPtr->TrackType ==
Bridge)
15069 if(PrefDirPtr->XLinkPos < 2)
15081 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
15090 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
15092 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
15093 PrefDirPtr->ConsecSignals)
15134 "," + AnsiString((
short)ConsecSignalsRoute));
15135 bool ElementInRoute =
false;
15136 bool TrainOccupyingRoute =
false;
15142 ElementInRoute =
true;
15146 if(!ElementInRoute)
15170 TrainOccupyingRoute =
true;
15238 if(LRVIT->RouteNumber == RouteNumber)
15253 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
15254 L
"Warning!", MB_YESNO | MB_ICONWARNING);
15266 bool ExistingLockedRouteModified =
false;
15279 if(LRVIT->RouteNumber == RouteNumber)
15283 ExistingLockedRouteModified =
true;
15287 if(!ExistingLockedRouteModified)
15375 AnsiString((
short)ConsecSignalsRoute));
15385 ConsecSignalsRoute);
15400 AnsiString((
short)ConsecSignalsRoute));
15410 RouteFlashElement.
HLoc = H;
15411 RouteFlashElement.
VLoc = V;
15427 int H = PrefDirPtr->HLoc;
15428 int V = PrefDirPtr->VLoc;
15490 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
15494 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
15497 OverlayPlotted =
false;
15507 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
15509 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
15512 return AllRoutesVector.at(At);
15521 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
15523 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
15526 return AllRoutesVector.at(At);
15537 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15539 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
15549 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15551 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
15569 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignalsRoute));
15570 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15573 RouteTruncateFlag =
true;
15575 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, ConsecSignalsRoute, ReturnFlag);
15576 RouteTruncateFlag =
false;
15603 AnsiString(LinkPos));
15604 if(TrackVectorPosition == -1)
15609 THVPair Route2MultiMapKeyPair;
15613 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15616 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15626 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15628 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15631 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
15632 Route2MultiMapIterator->second.second);
15633 EntryLinkPos = PrefDirElement1.
ELinkPos;
15634 ExitLinkPos = PrefDirElement1.
XLinkPos;
15635 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15636 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15648 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15660 Graphics::TBitmap* &EntryDirectionGraphicPtr)
15670 AnsiString(LinkPos));
15673 if(TrackVectorPosition == -1)
15678 THVPair Route2MultiMapKeyPair;
15682 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15685 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15690 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15692 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15694 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
15695 Route2MultiMapIterator->second.second);
15696 EntryLinkPos = PrefDirElement1.
ELinkPos;
15697 ExitLinkPos = PrefDirElement1.
XLinkPos;
15698 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15699 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15703 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
15704 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
15711 return AutoSigsRoute;
15716 return NotAutoSigsRoute;
15722 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
15723 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
15730 return AutoSigsRoute;
15735 return NotAutoSigsRoute;
15739 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15741 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
15742 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
15744 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
15745 EntryLinkPos = PrefDirElement2.
ELinkPos;
15746 ExitLinkPos = PrefDirElement2.
XLinkPos;
15747 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
15748 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
15752 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
15759 return AutoSigsRoute;
15764 return NotAutoSigsRoute;
15770 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
15777 return AutoSigsRoute;
15782 return NotAutoSigsRoute;
15787 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
15788 EntryLinkPos = PrefDirElement3.
ELinkPos;
15789 ExitLinkPos = PrefDirElement3.
XLinkPos;
15790 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
15791 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
15795 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
15802 return AutoSigsRoute;
15807 return NotAutoSigsRoute;
15813 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
15820 return AutoSigsRoute;
15825 return NotAutoSigsRoute;
15841 AnsiString(LinkPos));
15842 if(TrackVectorPosition == -1)
15848 THVPair Route2MultiMapKeyPair;
15852 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15855 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15861 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15863 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15865 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
15866 Route2MultiMapIterator->second.second);
15867 EntryLinkPos = PrefDirElement1.
ELinkPos;
15868 ExitLinkPos = PrefDirElement1.
XLinkPos;
15869 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15870 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15873 RouteNumber = Route2MultiMapIterator->second.first;
15877 return AutoSigsRoute;
15882 return NotAutoSigsRoute;
15887 RouteNumber = Route2MultiMapIterator->second.first;
15891 return AutoSigsRoute;
15896 return NotAutoSigsRoute;
15900 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15902 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
15903 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
15905 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
15906 EntryLinkPos = PrefDirElement2.
ELinkPos;
15907 ExitLinkPos = PrefDirElement2.
XLinkPos;
15908 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
15909 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
15912 RouteNumber = ItPair.first->second.first;
15916 return AutoSigsRoute;
15921 return NotAutoSigsRoute;
15926 RouteNumber = ItPair.first->second.first;
15930 return AutoSigsRoute;
15935 return NotAutoSigsRoute;
15940 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
15941 EntryLinkPos = PrefDirElement3.
ELinkPos;
15942 ExitLinkPos = PrefDirElement3.
XLinkPos;
15943 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
15944 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
15947 RouteNumber = ItPair.second->second.first;
15951 return AutoSigsRoute;
15956 return NotAutoSigsRoute;
15961 RouteNumber = ItPair.second->second.first;
15965 return AutoSigsRoute;
15970 return NotAutoSigsRoute;
15992 EmptyRoute.
RouteID = NextRouteID;
15995 AllRoutesVector.push_back(EmptyRoute);
15996 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
16021 AllRoutesVector.push_back(EmptyRoute);
16022 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
16045 THVPair Route2MultiMapKeyPair;
16054 LockedRouteTruncateTrackVectorPosition = 0;
16055 LockedRouteLastTrackVectorPosition = 0;
16056 LockedRouteLastXLinkPos = 0;
16057 LockedRouteLockStartTime = TDateTime(0);
16058 if(!LockedRouteVector.empty())
16062 if(LRVIT->RouteNumber == RouteNumber)
16064 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
16065 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
16066 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
16067 LockedRouteLockStartTime = LRVIT->LockStartTime;
16068 LockedRouteFoundDuringRouteBuilding =
true;
16069 LockedRouteVector.erase(LRVIT);
16095 AnsiString(VLoc) +
"," + AnsiString(ELink));
16098 ReturnPair.first = -1;
16099 ReturnPair.second = 0;
16100 THVPair Route2MultiMapKeyPair;
16102 Route2MultiMapKeyPair.first = HLoc;
16103 Route2MultiMapKeyPair.second = VLoc;
16106 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
16107 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
16109 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16110 Route2MultiMapIterator = ItPair.first;
16112 if(ItPair.first == ItPair.second)
16114 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
16117 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
16119 ReturnPair.first = ItPair.first->second.first;
16120 ReturnPair.second = ItPair.first->second.second;
16121 Route2MultiMapIterator = ItPair.first;
16126 if(ItPair.first == ItPair.second)
16128 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
16130 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
16132 ReturnPair.first = ItPair.first->second.first;
16133 ReturnPair.second = ItPair.first->second.second;
16134 Route2MultiMapIterator = ItPair.first;
16154 AnsiString(VLoc) +
"," + AnsiString(ELink));
16155 THVPair Route2MultiMapKeyPair;
16157 Route2MultiMapKeyPair.first = HLoc;
16158 Route2MultiMapKeyPair.second = VLoc;
16159 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
16161 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16163 if(ItPair.first == ItPair.second)
16170 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
16172 RouteNumber = ItPair.first->second.first;
16179 if(ItPair.first == ItPair.second)
16186 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
16188 RouteNumber = ItPair.first->second.first;
16209 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
16210 THVPair Route2MultiMapKeyPair;
16212 Route2MultiMapKeyPair.first = HLoc;
16213 Route2MultiMapKeyPair.second = VLoc;
16216 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
16219 RouteElementPair.first = RouteNumber;
16220 RouteElementPair.second = RouteElementNumber;
16221 Route2MultiMapEntry.second = RouteElementPair;
16223 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
16226 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
16227 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
16230 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
16231 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
16233 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
16235 Route2MultiMap.insert(Route2MultiMapEntry);
16240 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
16244 Route2MultiMap.insert(Route2MultiMapEntry);
16261 TempPair.first = -1;
16262 TempPair.second = 0;
16263 SecondPair = TempPair;
16265 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
16266 THVPair Route2MultiMapKeyPair;
16268 Route2MultiMapKeyPair.first = HLoc;
16269 Route2MultiMapKeyPair.second = VLoc;
16270 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
16275 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
16277 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
16279 return Route2MultiMapIterator->second;
16281 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
16283 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16284 TempPair = ItRange.first->second;
16285 SecondPair = (--ItRange.second)->second;
16308 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
16309 if(RouteElementPair.first == -1)
16312 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
16313 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
16315 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
16318 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
16319 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
16320 (AnsiString)Caller);
16322 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
16325 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
16326 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
16327 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
16328 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
16332 unsigned int SizeVal = 0;
16335 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
16337 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
16339 if(SizeVal != Route2MultiMap.size())
16341 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
16342 (AnsiString)Caller);
16358 if(!Route2MultiMap.empty())
16360 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
16362 if(Route2MultiMapIterator->second.first > RouteNumber)
16363 Route2MultiMapIterator->second.first--;
16379 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
16380 if(!Route2MultiMap.empty())
16382 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
16384 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
16385 Route2MultiMapIterator->second.second--;
16403 AnsiString(ELink));
16407 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
16408 if(RequiredRoutePair.first == -1)
16410 throw Exception(
"Failed to find route element in RemoveRouteElement");
16412 Route2MultiMap.erase(Route2MultiMapIterator);
16413 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
16416 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
16438 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
16439 RequiredRoutePair.second)));
16450 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
16459 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
16461 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
16462 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
16463 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
16475 if(!LockedRouteVector.empty())
16479 if(LRVIT->RouteNumber > RequiredRoutePair.first)
16481 LRVIT->RouteNumber--;
16492 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
16493 AutoSigVectorIT->RouteNumber--;
16497 CheckMapAndRoutes(7);
16511 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
16512 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
16513 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
16529 "," + AnsiString(XLinkPos));
16533 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
16534 if(RouteElementPair.first == -1)
16536 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
16538 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
16540 RequiredPair = RouteElementPair;
16541 if(RouteElement.
XLinkPos != XLinkPos)
16543 if(SecondPair.first != -1)
16545 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
16546 RequiredPair = SecondPair;
16547 if(RouteElement.
XLinkPos != XLinkPos)
16549 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
16554 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
16559 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
16579 AnsiString(AccessNumber));
16581 int Attribute = AccessNumber + 1;
16583 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
16587 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
16591 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
16594 x).XLinkPos] !=
End)
16596 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
16599 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
16641 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
16642 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
16643 int RearwardLinkedRouteNumber;
16667 int TrainID, TrainPosition, BehindTrainPosition;
16668 bool FoundTrain =
false, BehindTrain =
false;
16669 for(
int x = RouteStartPosition; x >= 0; x--)
16671 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
16690 if(FoundTrain && (TrainPosition > 1))
16692 for(
int x = TrainPosition; x >= 0; x--)
16697 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
16711 BehindTrain =
true;
16712 BehindTrainPosition = x;
16719 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
16736 AnsiString(RouteTruncatePosition));
16737 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
16738 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
16741 bool ExamineRoute =
true;
16743 while(ExamineRoute)
16745 for(
int x = StartPosition; x >= 0; x--)
16782 if(SignalCount >= 3)
16801 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
16802 ExamineRoute =
true;
16803 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
16834 ExamineRoute =
false;
16849 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
16852 PrefDirElement = InternalPrefDirElement;
16853 if(LockedRouteVector.empty())
16860 bool InLockedRoute =
false;
16864 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
16867 InLockedRoute =
true;
16877 int RouteNumber, VectorCount = 0;
16882 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
16883 if(RouteType == NoRoute)
16887 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
16890 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
16892 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
16894 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
16895 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
16899 PrefDirElement = InternalPrefDirElement;
16900 LockedVectorNumber = VectorCount;
16905 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
16909 PrefDirElement = InternalPrefDirElement;
16910 LockedVectorNumber = VectorCount;
16929 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
16931 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
16937 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
16947 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
16949 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
16964 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
16966 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
16969 return GetFixedRouteAt(159, x);
16972 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
16980 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
16982 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
16985 return GetModifiableRouteAt(15, x);
16988 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
16998 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17000 TOneRoute OneRoute = GetFixedRouteAt(165, x);
17012 int NumberOfRoutes;
17016 for(
int x = 0; x < NumberOfRoutes; x++)
17023 StoreOneRouteAfterSessionLoad(0, &OneRoute);
17041 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
17048 if((NextID < 0) || (NextID > 1000000))
17053 for(
int x = 0; x < NumberOfRoutes; x++)
17077 AnsiString(StartPosition));
17078 if(EndPosition == StartPosition)
17084 int TVPos = EndPosition;
17085 int LkPos = EndXLinkPos;
17087 while(TrackIsInARoute(15, TVPos, LkPos))
17108 if((NewLkPos == 0) || (NewLkPos == 2))
17120 if(TVPos == StartPosition)
17152 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
17157 if(FirstPair.first > -1)
17160 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17165 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17171 if(SecondPair.first > -1)
17174 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17179 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17186 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
17194 if(FirstPair.first > -1)
17197 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17202 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17208 if(SecondPair.first > -1)
17211 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17216 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17223 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
17231 if(FirstPair.first > -1)
17234 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17239 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17245 if(SecondPair.first > -1)
17248 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17253 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17260 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
17268 if(FirstPair.first > -1)
17271 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17276 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17282 if(SecondPair.first > -1)
17285 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17290 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17297 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
17322 "," + AnsiString(DiagonalLinkNumber));
17327 if(FirstPair.first > -1)
17330 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17335 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17341 if(SecondPair.first > -1)
17344 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17349 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17357 if(FirstPair.first > -1)
17360 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17365 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17371 if(SecondPair.first > -1)
17374 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17379 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17387 if(FirstPair.first > -1)
17390 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17395 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17401 if(SecondPair.first > -1)
17404 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17409 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17417 if(FirstPair.first > -1)
17420 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17425 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17431 if(SecondPair.first > -1)
17434 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17439 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))